package com.ymatou.iapi.productmanager.service;

import java.util.List;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.prodstock.parameter.LiveActivityDto;
import com.ymatou.iapi.productmanager.parameter.CategoryDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.business.YmatouAutoTestCall;
import com.ymttest.utils.EnvSetup;
/**
*获取买手所有的商品品类Call
*FreeMaker Template自动生成代码
*/
public class GetCategorysCall  extends YmatouAutoTestCall{
	private static String opurl ="api/SellerProduct/GetCategorys";
	
	public GetCategorysCall() {
		super(EnvSetup.getSystemUrl("productmanager"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public List<CategoryDto> getCategorys(){
		String sCategorys=getJsonObject().get("Data").getAsJsonObject().get("Categorys").getAsJsonArray().toString();
		List<CategoryDto> Categorys=(List<CategoryDto>)FormatUtil.GSONToObject(sCategorys, new TypeToken<List<CategoryDto>>(){}.getType());
		return Categorys;
	}
}